package com.bclz.environment;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class EnvironmentReduce extends Reducer<Environment,IntWritable,Text,Text> {

    @Override
    protected void reduce(Environment key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        StringBuffer sb=new StringBuffer("");
        values.forEach(s->sb.append(s+","));
        context.write(new Text(key.getYearAndMonth()),new Text(sb.toString()));

    }
}
